package io.renren.modules.vastFinance.service.impl;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.vastFinance.dao.ProductDao;
import io.renren.modules.vastFinance.entity.ProductEntity;
import io.renren.modules.vastFinance.service.ProductService;


@Service("productService")
public class ProductServiceImpl extends ServiceImpl<ProductDao, ProductEntity> implements ProductService {
   @Autowired
   ProductDao productDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
//        IPage<ProductEntity> page = this.page(
//                new Query<ProductEntity>().getPage(params),
//                new QueryWrapper<ProductEntity>()
//        );


        QueryWrapper<ProductEntity> chapterEntityQueryWrapper = new QueryWrapper<>();
        if (params.get("userId") != null && !params.get("userId").equals("")) {
            chapterEntityQueryWrapper.like("user_id",params.get("userId"));
        }
        IPage<ProductEntity> page = this.page(
                new Query<ProductEntity>().getPage(params),
                chapterEntityQueryWrapper
        );
        return new PageUtils(page);
    }


}